import 'package:flutter/material.dart';
import 'package:hello_flutter/widgets/layout/DDLayoutOne.dart';
import 'package:hello_flutter/widgets/layout/DDLayoutTwo.dart';
import 'package:hello_flutter/widgets/layout/DDLayoutThree.dart';
import 'package:hello_flutter/widgets/layout/DDLayoutFour.dart';
import 'package:hello_flutter/util/LoanUtils.dart';

class TestLayout extends StatefulWidget {
  @override
  _TestLayoutState createState() => _TestLayoutState();
}

class _TestLayoutState extends State<TestLayout> {
  @override
  Widget build(BuildContext context) {
    double screenWidth = MediaQuery.of(context).size.width;
    return Scaffold(
      appBar: AppBar(
        title: Text('自定义布局测试'),
      ),
      body: ListView(
        children: <Widget>[
          DDLayoutOne(
            width: screenWidth,
            // height: 100.0,
            child: Image.asset("assets/car/car01.jpg"),
          ),
          // DDLayoutOne(
          //   width: screenWidth,
          //   height: 30.0,
          //   child: TextField(

          //   ),
          // ),
          DDLayoutTwo(
            width: screenWidth,
            // height: 100.0,
            childLeft: Image.asset("assets/car/car02.jpg"),
            childRight: Image.asset("assets/car/car03.jpg"),
          ),
          DDLayoutTwo(
            width: screenWidth,
            // height: 100.0,
            childLeft: Text("姓名"),
            childRight: Text("陈格生", textAlign: TextAlign.right),
          ),
          DDLayoutTwo(
            width: screenWidth,
            // height: 100.0,
            childLeft: TextFormField(initialValue: "性别",),
            childRight: TextFormField(initialValue: "男", textAlign: TextAlign.right),
          ),
          DDLayoutThree(
            width: screenWidth,
            // height: 100.0,
            child1: Image.asset("assets/car/car04.jpg"),
            child2: Image.asset("assets/car/car05.jpg"),
            child3: Image.asset("assets/car/car06.jpg"),
          ),
          DDLayoutFour(
            width: screenWidth,
            // height: 100.0,
            child1: Image.asset("assets/car/car04.jpg"),
            child2: Image.asset("assets/car/car05.jpg"),
            child3: Image.asset("assets/car/car06.jpg"),
            child4: Image.asset("assets/car/car07.jpg"),
          ),
          DDLayoutTwo(
            width: screenWidth,
            // height: 100.0,
            childLeft: RaisedButton(
              color: Colors.blue,
              padding: EdgeInsets.all(10.0),
              child: Text(
                "上一步",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 16.0,
                ),
              ),
              onPressed: () {
                double value = 1.23;
                print("LoanUtils.toChineseMoneyText($value) = " + LoanUtils.toChineseMoneyText(value));
                value = 123456789.01;
                print("LoanUtils.toChineseMoneyText($value) = " + LoanUtils.toChineseMoneyText(value));
                value = 10002.50;
                print("LoanUtils.toChineseMoneyText($value) = " + LoanUtils.toChineseMoneyText(value));
                value = 12304.89;
                print("LoanUtils.toChineseMoneyText($value) = " + LoanUtils.toChineseMoneyText(value));
                value = 123.00;
                print("LoanUtils.toChineseMoneyText($value) = " + LoanUtils.toChineseMoneyText(value));
              },
            ),
            childRight: RaisedButton(
              color: Colors.blue,
              padding: EdgeInsets.all(10.0),
              child: Text(
                "下一步",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 16.0,
                ),
              ),
              onPressed: () {
                print("下一步");
              },
            ),
          ),
        ],
      ),
    );
  }
}